<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	<script type="text/javascript">
//		通过prompt返回的结果都是字符串类型的数据
		var num = prompt('请输入数字')*1;
		
		switch(num){
			case 1:
				document.write("向东走");
				break;
			case 2:
				document.write("向西走");
				break;
			case 3:
				document.write("向南走");
				break;
			case 4:
				document.write("向北走");
				break;
			default:
				document.write("输入错误");
		}
		
		
		
	</script>	
	
	</head>
	<body>
	</body>
</html>
